<style>
.jyui_cell_col .red {color: red;}
.fui-icon-group.col-7 .fui-icon-col {width: 14.28%;}
.signed {position: absolute;top:0;right:0.2rem;color:red;}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
</style>
<div ng-if="pagedata.showgoodsset" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
       <div class="tips tips-yellow" style="margin:0">
               <i class="fa fa-bullhorn"></i> 设置本订单的预约定期配送商品数量和类型，如果不会设置，可以让配送员或者店员帮忙设置！
         </div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">预约配送商品类型/数量</div>
				<div class="fui-cellone-remark noremark">
				</div>
		</div>
		<div class="fui-cell-group" style="padding:0 0.15rem">
				<div ng-repeat="g in pagedata.post.goods" class="fui-cell small">
                    <div class="fui-cell-info" style="padding-right:0.3rem">
                        <div class="text">{{g.title}}</div>
						<div class="subtitle">规格：{{g.optiontitle || '无'}}</div>
                    </div>
					<div class="fui-cell-remark noremark">
                        <div ng-if="!g.leixings || g.leixings.length<=0" class="fui-number small" style="right:0">
								<div ng-if="pagedata.post.peiset.goods[g.goodsid].num>0" class="minus" ng-click="pagedata.minus1(g)"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
								<input ng-if="pagedata.post.peiset.goods[g.goodsid].num>0" class="num shownum" type="text" ng-model="pagedata.post.peiset.goods[g.goodsid].num" style="width:1rem"/>
								<div class="plus" ng-click="pagedata.plus1(g)"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
						</div>
						<div ng-repeat="(k,lv) in g.leixings" class="fui-cellone" style="padding:0">
							<div class="fui-cellone-info red">{{lv.title}}</div>
							<div class="fui-cellone-remark noremark" style="margin-left:0.3rem">
							<div class="fui-number small" style="right:0">
								<div class="minus" ng-click="pagedata.minus2(g,k)"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
								<input class="num shownum" type="text" ng-model="pagedata.post.peiset.goods[g.goodsid+'_'+k].num" style="width:1rem"/>
								<div class="plus" ng-click="pagedata.plus2(g,k)"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
							</div>
							</div>
						</div>
                    </div>
                </div>
				<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.goods || pagedata.goods.length<=0">
						<i class='icon icon-information'></i><br/>暂时没有可设置的商品!
				</div>
		</div>
        <div class="fui-cell-group">
                <div class="fui-cell small ">
                    <div class="fui-cell-info">
                        <label class="checkbox-inline">
                            <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger" ng-checked="pagedata.post.peiset.agree==1" ng-model="pagedata.post.peiset.agree" /> 我已经阅读并了解了<a id="btn-apply" ng-click="pagedata.show_content=true" style="color:#337ab7;">【{{pagedata.yuyuexieyi.title}}】</a>。
                        </label>

                    </div>
                </div>
         </div>
        <div class="fui-navbar">
			<a ng-click="pagedata.showgoodsset=false;" class="nav-item btn btn-danger confirmbtn">提交设置</a>
		</div>
		 </div>
		</div>
<script language='javascript'>
//减少
scope.pagedata.minus1=function(g){
	scope.pagedata.post.peiset.goods[g.goodsid]=scope.pagedata.post.peiset.goods[g.goodsid]?scope.pagedata.post.peiset.goods[g.goodsid]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	if(scope.pagedata.post.peiset.goods[g.goodsid].num<=0){
		return false;
	}
	scope.pagedata.post.peiset.goods[g.goodsid].num--
}
//增加
scope.pagedata.plus1=function(g){
	scope.pagedata.post.peiset.goods[g.goodsid]=scope.pagedata.post.peiset.goods[g.goodsid]?scope.pagedata.post.peiset.goods[g.goodsid]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	if(scope.pagedata.post.peiset.goods[g.goodsid].num>=g.lastnum){
		scope.message('不能再添加了，已超过剩余商品数量！','error');
		return false;
	}
	scope.pagedata.post.peiset.goods[g.goodsid].num++
}
//减少
scope.pagedata.minus2=function(g,k){
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]=scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]?scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].title=g.goods_title
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].ktitle=g.leixings[k].title
	if(scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].num<=0){
		return false;
	}
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].num--
}
//增加
scope.pagedata.plus2=function(g,k){
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]=scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]?scope.pagedata.post.peiset.goods[g.goodsid+'_'+k]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].goodsid=g.goodsid
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].title=g.goods_title
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].ktitle=g.leixings[k].title
	var isnum=0;
	for(var i=0;i<g.leixings.length;i++){
		scope.pagedata.post.peiset.goods[g.goodsid+'_'+i]=scope.pagedata.post.peiset.goods[g.goodsid+'_'+i]?scope.pagedata.post.peiset.goods[g.goodsid+'_'+i]:0;
		isnum=isnum+scope.pagedata.post.peiset.goods[g.goodsid+'_'+i].num
	}
	if(isnum>=g.lastnum){
		scope.message('不能再添加了，已超过剩余商品数量'+g.lastnum+'！','error');
		return false;
	}
	scope.pagedata.post.peiset.goods[g.goodsid+'_'+k].num++
}
</script>
</div>